unit GLGUIComponent;

interface

uses
  Classes,
  GLGUIWidget,
  GLGUIFonts,
  GLColor,
  GLGUIBoundedLabel,
  VectorGeometry;

type
  TGLGUILabeled = class(TGLGUIWidget)
  protected
    FLabel: TGLGUIBoundedLabel;
    FFont: TGLGUIFont;
    function GetTextColor() : TGLColor;
    function GetTextColorDirect() : TVector;
    procedure SetTextColorDirect(AColor: TVector); virtual;
    function GetFont: TGLGUIBitmapFont;
    procedure SetFont(AFont: TGLGUIBitmapFont);
    function GetText: String;
    procedure SetText(AText: String);
  public
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;
    property TextColor: TGLColor read GetTextColor;
    property TextColorDirect: TVector read GetTextColorDirect write
      SetTextColorDirect;
    property Font: TGLGUIBitmapFont read GetFont write SetFont;
    property Caption:String read GetText write SetText;
  end;

implementation

constructor TGLGUILabeled.Create(AOwner: TComponent);
begin
  inherited;
  FLabel := TGLGUIBoundedLabel.CreateAsChild(Self);
  FFont := FLabel.Font;
end;

function TGLGUILabeled.GetTextColor: TGLColor;
begin
  Result := FLabel.Color;
end;

function TGLGUILabeled.GetTextColorDirect: TVector;
begin
  Result := FLabel.Color.Color;
end;

procedure TGLGUILabeled.SetTextColorDirect(AColor: TVector);
begin
  FLabel.Color.Color := AColor;
end;

function TGLGUILabeled.GetFont: TGLGUIBitmapFont;
begin
  Result := FLabel.Font;
end;

procedure TGLGUILabeled.SetFont(AFont: TGLGUIBitmapFont);
begin
  FLabel.Font := AFont;
end;

function TGLGUILabeled.GetText: String;
begin
  Result := FLabel.Text;
end;

procedure TGLGUILabeled.SetText(AText: String);
begin
  FLabel.Text := AText;
end;

destructor TGLGUILabeled.Destroy;
begin
  inherited;
end;

end.
